#ifndef __DEBUG_H__
#define __DEBUG_H__

#define ERROR       0
#define WARNING     1
#define NOTICE      2
#define INFO        3
#define DEBUG       4

#define DEBUG_LEVEL 4

#define LEVEL_ERROR "error"
#define LEVEL_WARNING   "warning"
#define LEVEL_NOTICE    "notice"
#define LEVEL_INFO  "info"
#define LEVEL_DEBUG "debug"

#ifdef  DEBUG_LEVEL
#define debug(level, tag, format, args...) do { \
    if (level <= DEBUG_LEVEL) { \
        printf("%s:\t", LEVEL_##level); \
        printf("<%s> ", tag); \
        printf(format, args); \
    } \
} while (0)
#else
#define debug(tag, format, args...)
#endif

#endif

